* finalize address match - convert from xlsx to dta
********************************************************************************
* prelims
********************************************************************************
{
clear all
set more off
cap log close

}
********************************************************************************
* link survey and catastro addresses
********************************************************************************
{
* load data
import excel "$data/int/survey_match_final.xlsx", sheet("Current") firstrow clear

* fake address variable
rename FakeAddress fakecurrent

* drop duplicates
duplicates drop StreetType StreetName StreetNum ZIPCode, force

* remove leading white spaces in PlotCode
replace PlotCode = subinstr(PlotCode," ","",.)

* keep relevant variables
keep StreetType StreetName StreetNum ZIPCode PlotCode fakecurrent

* store
compress
save "$data/int/address_match.dta", replace

}
********************************************************************************
* closing
********************************************************************************
{
clear all
cap log close

}
